<template>
  <div class="articleWrap">
    <van-cell
      :to="{
        name: 'article',
        params: {
          id: articleValue.art_id,
        },
      }"
    >
      <!-- 标题 -->
      <template #title>
        <div class="title van-multi-ellipsis--l3">{{ articleValue.title }}</div>
      </template>
      <template #label>
        <!-- 三张图片的时候 -->
        <div class="articleImg" v-if="articleValue.cover.type === 3">
          <div class="father-item">
            <div
              class="articleImg-item"
              v-for="(item, index) in articleValue.cover.images"
              :key="index"
            >
              <van-image
                height="73"
                :key="index"
                fit="cover"
                class="aaa"
                :src="item"
              />
            </div>
          </div>
        </div>
        <div class="articlText">
          <span>{{ articleValue.aut_name }}</span>
          <span>{{ articleValue.collect_count }}</span>
          <span>{{ articleValue.pubdate | relativeTime }}</span>
        </div>
      </template>
      <!-- 一张图片的时候 -->
      <template #default v-if="articleValue.cover.type === 1">
        <van-image
          width="116"
          height="73"
          fit="cover"
          :src="articleValue.cover.images[0]"
        />
      </template>
    </van-cell>
  </div>
</template>
<script>
export default {
  name: 'ArticleItem',
  props: {
    articleValue: {
      type: Object,
      require: true
    }
  }
}
</script>
<style scoped lang="less">
.articleWrap {
  .title {
    font-size: 16px;
    color: #3a3a3a;
  }
  /deep/.van-cell__value {
    flex: unset;
  }
  .father-item {
    display: flex;
    padding: 15px 0;
    .articleImg-item {
      flex: 1;
      flex-wrap: nowrap;
      &:not(:last-child) {
        padding-right: 6px;
      }
    }
  }
  .articlText > span {
    margin-right: 15px;
  }
}
</style>
